﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;

namespace GenericBasics
{
    class Program
    {
        static void Main(string[] args)
        {
            Range<int> r1 = new Range<int>()
            {
                Min = 0,
                Max = 10
            };

            Range<float> r2 = new Range<float>()
            {
                Min = 0f,
                Max = 10f
            };

            Range<char> r3 = new Range<char>() 
            { 
                Min = 'a',
                Max = 'z'
            };

            Range<DayOfWeek> r4 = new Range<DayOfWeek>() 
            {
                Min = DayOfWeek.Monday,
                Max = DayOfWeek.Friday
            };

            var kv1 = new KeyValue<int, string>()
            {
                Key = 0,
                Value = "John"
            };

            var doubleList = new List<double>
            {
                1.1, 2.5, 36.2
            };

            var rangeList = new List<Range<double>>
            {
                new Range<double> 
                {
                    Min = -1.5,
                    Max = 2.5
                },

                new Range<double> 
                {
                    Min = 0,
                    Max = 22.5
                },
            };

            ArrayList arrayList = new ArrayList();
            arrayList.Add(2);
            arrayList.Add("Hello");
            arrayList.Add(new Range<char>() { Min = 'a', Max = 'z' });

            Dictionary<string, string> dict = new Dictionary<string, string>();

            dict.Add("ողջույն", "hello");

            Console.WriteLine(dict["ողջույն"]);


            Dictionary<string, int> myDict = new Dictionary<string, int>();

            Stopwatch sw = new Stopwatch();
            var temp = 0;

            sw.Start();
            for (int i = 0; i < 1000000; i++)
            {
                myDict[i.ToString()] = i;
            }
            sw.Stop();

            Console.WriteLine("t = {0}", sw.ElapsedMilliseconds);

            sw.Restart();
            foreach (var key in myDict.Keys)
            {
                //Console.WriteLine("{0}: {1}",key, myDict[key]);
                temp = myDict[key];
            }
            sw.Stop();

            Console.WriteLine("t = {0}", sw.ElapsedMilliseconds);

            
            sw.Restart();
            foreach (var keyValue in myDict)
            {
                //Console.WriteLine("{0}: {1}",keyValue.Key, keyValue.Value);
                temp = keyValue.Value;
            }
            sw.Stop();

            Console.WriteLine("t = {0}", sw.ElapsedMilliseconds);

            Console.ReadKey();
        }
    }
}
